<?php
/**
 * Created by PhpStorm.
 * User: kcj
 * Date: 2017/6/13
 * Time: 9:26
 */

$client = stream_socket_client('tcp://127.0.0.1:7273');
if(!$client)exit("can not connect");
// 模拟超级用户，以文本协议发送数据，注意Text文本协议末尾有换行符（发送的数据中最好有能识别超级用户的字段），这样在Event.php中的onMessage方法中便能收到这个数据，然后做相应的处理即可
$key=array("12ww2",'qwe');
$s='';
for($i=0;$i<count($key);++$i)
    $s.='content'.$i.':"'.$key[$i].'",';
print_r('{"type":"del","roomid":"123",'.$s.'"user":"admin", "pass":"******"}'."\n");
fwrite($client, '{"type":"del","roomid":"123","content":"'.json_encode($key).'", "user":"admin", "pass":"******"}'."\n");
